home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Misc / AWNP / AWNP-Docs / Demos / drawlist.rx < prev    next >
Encoding:
Text File  |  2000-04-30  |  1.6 KB  |  69 lines

  1. /* AWNP drawlist example
  2. some drawlist shapes
  3.  sorry no comments, read the drawlist docs..*/
  4.  
  5. dld=''
  6. count=10;
  7.  
  8. call linestart(10,25)
  9. dld=dld||line(100,25)
  10. call linestart(10,50)
  11. dld=dld||line(100,50)
  12. call linestart(10,75)
  13. dld=dld||line(100,75)
  14.  
  15. /* change the data and the script won't work */
  16. data='11 15 34 56 43 56 67 54 55 37 '
  17. parse var data datum data
  18. linestart(count,datum)
  19. count=count+10
  20. do while data~=''
  21. olddatum=datum
  22. parse var data datum data
  23. dld=dld||line(count,100-datum)
  24. dld=dld||rect(count-2,110-datum,count+2,100)
  25. top=datum+(datum-olddatum)
  26. bottom=datum+(olddatum-datum)
  27. dld=dld||candle(110-top,110-bottom,100)
  28. count=count+10
  29. end
  30.  
  31. dld=dld||'000000000000000000000000'x
  32. call open(ca,'awnpipe:drl/xc')
  33. call writeln(ca,'"Drawlist shapes" defg width 300 height 200')
  34. call writeln(ca,'drawlist minw 110 minh 100 bd dld 'length(dld))
  35. call writech(ca,dld)
  36. call writeln(ca,'image')
  37. call writeln(ca,'open')
  38. exit
  39.  
  40.  
  41. linestart:
  42. oldx=arg(1)
  43. oldy=arg(2)
  44. return(0)
  45.  
  46. line:
  47. t='0001'x||'0'x||d2c(oldx)||'0'x||d2c(oldy)'0'x||d2c(arg(1))||'0'x||d2c(arg(2))||'0'x||d2c(1)
  48. oldx=arg(1)
  49. oldy=arg(2)
  50. return(t)
  51.  
  52. rect:
  53. t='0002'x||'0'x||d2c(arg(1))||'0'x||d2c(arg(2))'0'x||d2c(arg(3))||'0'x||d2c(arg(4))||'0'x||d2c(2)
  54. return(t)
  55.  
  56. candle:
  57. t='0001'x||'0'x||d2c(count-5)||'0'x||d2c(arg(1))'0'x||d2c(count-5)||'0'x||d2c(arg(2))||'0'x||d2c(3)
  58. if arg(1)>arg(2) then dif= arg(1)-arg(2)
  59. else dif= arg(2)-arg(1)
  60. dif=dif/4
  61. parse var dif dif '.' .
  62. cen=(arg(1)+arg(2))/2
  63. parse var cen cen '.' .
  64. t=t||'0002'x||'0'x||d2c(count-7)||'0'x||d2c(cen-dif)'0'x||d2c(count-3)||'0'x||d2c(cen+dif)||'0'x||d2c(3)
  65. t=t||'0004'x||'0'x||d2c(count)||'0'x||d2c(25)'0'x||d2c(1)||'0'x||d2c(dif)||'0'x||d2c(3)
  66.  
  67. return(t)
  68.  
  69.